{% set pypi_name = 'python-scciclient' %}
{% set upstream_version = upstream_version('0.8.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python API and CLI for OpenStack Scci
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
# https://review.opendev.org/687023
Patch0:         0001-Switch-from-oslosphinx-to-openstackdocstheme.patch
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pyghmi') }}
BuildRequires:  {{ py3('pysnmp') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('setuptools') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pyghmi') }}
Requires:       {{ py3('pysnmp') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
Client library for Scci built on the Scci API. It provides a Python API
(the scciclient module) and a command-line tool (scci).

%package doc
Summary:        Documentation for OpenStack Scci API client libary
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description doc
Client library for Scci built on the Scci API. It provides a Python API
(the scciclient module) and a command-line tool (scci).
This package contains the documentation.

%prep
%autosetup -p1 -n %{name}-%{version}
%py_req_cleanup

%build
%py3_build

# Build HTML docs and man page
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%py3_install

%check
%{__python3} -m stestr.cli run

%files
%doc README.rst
%license LICENSE
%{python3_sitelib}/scciclient
%{python3_sitelib}/*.egg-info

%files doc
%doc doc/build/html
%license LICENSE

%changelog
